/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ia_0.data_model.actions;
import ia_0.Move;
import ia_0.data_model.character.Character;
import ia_0.data_model.character.POI;

/**
 *
 * @author yguo
 */
public class ActionPorter extends Action{
    
    boolean mettreWater=false;

        public ActionPorter(Character c){
        super(c);
    }

    public boolean toDo() {
        boolean finded=false;
        if(c.knowledge.getPoi(POI.TypePOI.water)!=null)
            finded=true;
        return finded;
    }

    @Override
    public void doIt() {
        setCommence();
        if(m==null&&mettreWater==false){
            m=new Move(c, c.knowledge.getPoi(POI.TypePOI.water).position);
            mettreWater=true;
        }
        if(m==null&&mettreWater==true){
            m=new Move(c, c.knowledge.getPoi(POI.TypePOI.waterHouse).position);
            mettreWater=false;
        }

        if(m.iterate().equals(m.dest)){
            m=null;
        }

    }

}